package com.example.mapper;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.dto.Register;
import com.example.pojo.applyInfo;
import com.example.pojo.user;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    //根据用户名(学号)查询
    @Select("select * from user where Name=#{username}")
    user findByUserName(String username);

    //添加用户
    @Insert("insert into user(Name,Password,ContactInfo,email)"+"values(#{username},#{password},#{numPhone},#{email})")
    void add(Register register);

    //更新用户信息
    @Update("update user set realname=#{realname},Gender=#{gender},MajorID=#{MajorID},EducationID=#{EducationID},img=#{img} where Name=#{name}")
    void update(user u);

    //修改密码
    @Update("update user set Password=#{pwd} where Name=#{username}")
    void updatePwd(String pwd,String username);

    //获取用户岗位申请信息
    @Select("select EmployerName,PositionName,Salary,Status from applyInfo where StudentID=#{id}")
    IPage<applyInfo> applyInfo(Page<applyInfo> applyInfoPage, String id);

    //插入用户岗位申请信息
    @Insert("insert into applyInfo(EmployerName,PositionName,Salary,Status,StudentID)"+
            "values(#{EmployerName},#{PositionName},#{Salary},#{Status},#{StudentID})")
    void apply(applyInfo a);
}
